﻿<Controls:SinacorWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                         xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
                         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                         mc:Ignorable="d"
                         xmlns:Model="clr-namespace:Sinacor.UI.Bovespa.Corretagem.Model;assembly=Sinacor.UI.Bovespa.Corretagem.Model"
                         xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
                         WindowStartupLocation="CenterScreen" 
                         AutoContentHeight="True" 
                         AutoContentWidth="True"
                         WindowState="Maximized" 
                         Title="{DynamicResource Bovespa.Cliente.Label.CadastroFaixasCorretagem}"
                         x:Class="Sinacor.UI.Bovespa.Corretagem.View.SmartClient.CadastroFaixasCorretagem" 
                         ModulePlus="False"
                         ModuleId="ORD">

    <Controls:SinacorExpanderContainer x:Name="ExpanderContainer"
                                       VerticalAlignment="Stretch">

        <Controls:SinacorExpanderContainer.RowDefinitions>
            <RowDefinition Height="65"/>
            <RowDefinition Height="*"/>
        </Controls:SinacorExpanderContainer.RowDefinitions>

        <Controls:SinacorExpander HorizontalAlignment="Stretch"
                                  VerticalAlignment="Top"
                                  Header="{DynamicResource Bovespa.Corretagem.Label.Pesquisa}"
                                  AllowExpand="True"
                                  IsExpanded="True" Grid.Row="0" x:Name="ExpPesquisar"
                                  TabIndex="6">
            <Grid>
                <Controls:SinacorLabel HorizontalAlignment="Left"
                                       Content="{DynamicResource Bovespa.Corretagem.Label.DataInicial}"
                                       Width="85"/>
                <Controls:SinacorDatePicker HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Margin="89,0,0,0"
                                            TabIndex="1" x:Name="dpDataInicialFiltro" Value="{Binding Filtro.Periodo.DataInicial}"/>
                <Controls:SinacorLabel HorizontalAlignment="Left" 
                                       Content="{DynamicResource Bovespa.Cliente.Label.DataFinal}" 
                                       Width="85"
                                       Margin="198,0,0,4"
                                       VerticalAlignment="Stretch" />
                <Controls:SinacorDatePicker HorizontalAlignment="Left"
                                            Margin="287,0,0,4"
                                            TabIndex="2" x:Name="dpDataFinalFiltro" Value="{Binding Filtro.Periodo.DataFinal}" />
                <Controls:SinacorButton HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        Content="{DynamicResource Bovespa.Corretagem.Label.Pesquisar}"
                                        Margin="400,0,0,0"
                                        Width="85"
                                        TabIndex="3"
                                        IsDefault="True" x:Name="btnPesquisar"/>
                <Controls:SinacorButton HorizontalAlignment="Left" 
                                        VerticalAlignment="Top"
                                        Margin="489,0,0,0" 
                                        TabIndex="4" 
                                        IsDefault="False"
                                        x:Name="btnNovaPesquisa"
                                        Content="{DynamicResource Bovespa.Corretagem.Label.NovaPesquisa}"/>
            </Grid>
        </Controls:SinacorExpander>
        <Controls:SinacorExpander HorizontalAlignment="Stretch"												
                                  VerticalAlignment="Stretch"												
                                  Header="{DynamicResource Bovespa.Corretagem.Label.FaixasCorretagem}" Grid.Row="1"
                                  IsExpanded="True"
                                  TabIndex="6"
                                  AllowExpand="False"
                                  Margin="0,4,0,0">
            <Grid>
                <Controls:SinacorDataGrid IsSynchronizedWithCurrentItem="True" 							 		
                                          AllowBeginInsert="True" 							 		
                                          AllowBeginUpdate="True" 							 		
                                          AllowCancelInsert="True" 							 		
                                          AllowCancelUpdate="True" 							 		
                                          AllowEndInsert="True" 							 		
                                          AllowEndUpdate="True" 
                                          AllowDelete="True"
                                          ItemsSource="{Binding Path=ListaFaixasCorretagem}" 
                                          SelectionMode="Single" 		
                                          HorizontalAlignment="Stretch"
                                          Margin="0,0,0,0"
                                          x:Name="dtgFaixaCorretagem"
                                          BeingUpdated="dtgFaixaCorretagem_BeingUpdated"
                                          BeingInserted="dtgFaixaCorretagem_BeingInserted"
                                          CancelingInsert="dtgFaixaCorretagem_CancelingInsert"
                                          >
                    <Controls:SinacorDataGrid.Columns>
                        <Controls:Column Name="DataInicial"								 				
                                         AutoAdjustWidthToContent="True"
                                         HorizontalCellAlignment="Center"
                                         Title="Bovespa.Corretagem.Label.DataInicial"										
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="DataInicial" 
                                         AllowInsert="True" 
                                         AllowUpdate="False" 
                                         > 
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDatePicker Value="{Binding DataInicial}" IsRequired="True" LostFocus="SinacorDatePicker_LostFocus" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.DataInicialObrigatorio"   />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="DataFinal" 				
                                         AutoAdjustWidthToContent="True" 
                                         HorizontalCellAlignment="Center"
                                         Title="Bovespa.Cliente.Label.DataFinal"										
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="DataFinal"
                                         AllowInsert="True" 
                                         AllowUpdate="False" >
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDatePicker Value="{Binding DataFinal}" IsRequired="True" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.DataFinalObrigatoria"  />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="NumFaixa" 									 				
                                         Title="Bovespa.Corretagem.Label.NoFaixa"
                                         HorizontalCellAlignment="Right"
                                         AutoAdjustWidthToContent="True"																		 				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="NumeroFaixa"
                                         AllowInsert="True" 
                                         AllowUpdate="False">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox 
                                        Value="{Binding NumeroFaixa}" 
                                        IsRequired="True" 
                                        Integers="2"
                                        x:Name="txtNumeroFaixa" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.NumeroFaixaNaoInformado"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="ValorInferior" 																 				
                                         AutoAdjustWidthToContent="True"
                                         HorizontalCellAlignment="Right"
                                         Title="Bovespa.Corretagem.Label.ValorInferior"													
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="ValorInferior"
                                         StringFormat="f2"
                                         AllowInsert="True" 
                                         AllowUpdate="True">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox 
                                        Value="{Binding ValorInferior}" 
                                        x:Name="txtValorInferior" 
                                        IsRequired="True" 
                                        Integers="13" 
                                        Decimals="2"
                                        IsFormated="False" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.ValorInferiorNaoInformado"
                                        />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="ValorSuperior" 																 				
                                         AutoAdjustWidthToContent="True"
                                         HorizontalCellAlignment="Right"
                                         Title="Bovespa.Corretagem.Label.ValorSuperior"										
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="ValorSuperior"
                                         StringFormat="f2"
                                         AllowInsert="True" 
                                         AllowUpdate="False">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox
                                        Name="txtValorSuperior"
                                        Value="{Binding ValorSuperior}" 
                                        IsRequired="True" 
                                        Integers="13" 
                                        Decimals="2"
                                        IsFormated="False" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.ValorSuperiorNaoInformado"
                                        />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="PercentualAliquota" 									 				
                                         Title="Bovespa.Corretagem.Label.PercAliquota"
                                         HorizontalCellAlignment="Right"
                                         AutoAdjustWidthToContent="True" 									 				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="PercentualAliquota"
                                         StringFormat="f4"
                                         AllowInsert="True" 
                                         AllowUpdate="True">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox
                                        Name="txtPercentualAliquota"
                                        Value="{Binding PercentualAliquota}" 
                                        IsRequired="True" 
                                        Integers="3" 
                                        Decimals="4"
                                        IsFormated="False" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.PercentualAliquotaObrigatoriotualAliquotaObrigatorio"
                                        />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                        <Controls:Column Name="ValorAcrescimo" 									 				
                                         Title="Bovespa.Corretagem.Label.ValorAcrescimo"
                                         HorizontalCellAlignment="Right"
                                         AutoAdjustWidthToContent="True" 									 				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         DisplayMemberPath="ValorAcrescimo"
                                         StringFormat="f2"
                                         AllowInsert="True" 
                                         AllowUpdate="True">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox
                                        Name="txtValorAcrescimo"
                                        Value="{Binding ValorAcrescimo}" 
                                        IsRequired="True" 
                                        Integers="13" 
                                        Decimals="2"
                                        IsFormated="False" RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.ValorAcrescimoObrigatorio"
                                        />
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>
                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>
</Controls:SinacorWindow>
